﻿<!--//=============================================================
    // Copyright (C) 2015 福流网络
    // 作 者：钟星星
    // 日 期：2016-05-26
    // 描 述:  华为海运账单明细
    // 版 本：1.00
    // 修改历史纪录
    // 版 本  修改时间      修改人            修改内容
    //=============================================================-->

<table>
    <tr>
        <td style="float: left;">
            <a class="mini-button" iconcls="icon_find" onclick="fnExportMuBan()">导出</a>
        </td>
    </tr>
</table>

<!--导出Excel相关HTML-->
<iframe id="exportIFrame" name="excelIFrame" style="display: none"></iframe>

<!--导出Excel相关HTML-->
<form id="excelForm" method="post" target="excelIFrame" style="display: none;">
    <input type="hidden" name="columns" id="excelColumns" />
    <input type="hidden" name="condition" id="hidCondition" />  <!--@*视图条件*@-->
</form>

<iframe id="excelIFrame" name="excelIFrame" style="display: none"></iframe>





<script type="text/javascript">

    //导出按钮
    function fnExportMuBan() {
        var condition = fnGetCondition("QueryItem"); //获取页面上的查询条件

        var msg = mini.loading("数据处理中，请稍后......", "系统消息提醒");
        //var columns = mini.encode(GetColumns("datagrid1"));
        //var json = mini.encode(columns);

        var columns = GetColumns("datagrid1");
        var json = mini.encode(columns);
        document.getElementById("excelColumns").value = json;
        $("#hidCondition").val(condition);

        var excelForm = document.getElementById("excelForm");
        excelForm.action = "../../HuaweiSeaTransportDetailsCount/ExportHuaweiSeaTransportDetailsCountExcel";
        excelForm.submit();
        mini.hideMessageBox(msg);

    }


    function GetColumns(gridName) {
        var grid = mini.get(gridName);
        var columns = grid.getBottomColumns();

        columns = columns.clone();
        for (var i = columns.length - 1; i >= 0; i--) {
            var column = columns[i];
            //if (!column.field) {
            //    columns.removeAt(i);
            //} else {
            //    var c = { header: column.header, field: column.field };
            //    columns[i] = c;
            //}
            if (column.type != "checkcolumn") {
                var c = {};
                if (column.field == undefined) {
                    c = { header: "序号", field: "number_no" };
                } else {
                    c = { header: column.header, field: column.field };
                }
                columns[i] = c;
            } else {
                columns.removeAt(i);
            }
        }
        return columns;

    }





</script>